package cn.ming.wfchat.app.me.activity.adapter;

import android.widget.RelativeLayout;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import cn.ming.wfchat.R;
import cn.ming.wfchat.app.me.activity.model.ToWithdrawalBean;

public class AddressAdapter extends BaseQuickAdapter<ToWithdrawalBean.AddressListBean, BaseViewHolder> {

    public AddressAdapter(List<ToWithdrawalBean.AddressListBean> data) {
        super(R.layout.item_address, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ToWithdrawalBean.AddressListBean item) {
        helper.setText(R.id.tv_tag, "标签 ：" + item.getName());
        helper.setText(R.id.tv_adds, "地址 ：" + item.getAddress());
        helper.setVisible(R.id.iv_img, item.isSelected());
        RelativeLayout rl_layout = helper.getView(R.id.rl_layout);
        if (item.isSelected()) {
            rl_layout.setBackground(mContext.getResources().getDrawable(R.drawable.diog_8dp_4a));
            helper.setVisible(R.id.iv_delete, false);
        } else {
            rl_layout.setBackground(mContext.getResources().getDrawable(R.drawable.diog_8dp_00));
            helper.setVisible(R.id.iv_delete, true);
        }
        helper.addOnClickListener(R.id.iv_delete);

    }
}
